home *** CD-ROM | disk | FTP | other *** search
- Const Cfgname_hlp = "Write the name of your security file here."
- Const Cfgmake_hlp = "Press to make a new security file with a new serial number."
- Const Feature_hlp = "The feature code ( 1 - 15 ) for which you want to make a registration code."
- Const Regmake_hlp = "Press to create a matching registration code."
- Const Uname_hlp = "The name of the registered user that you want in the security file."
- Const Ucompany_hlp = "The name of the users company"
- Const Setnames_hlp = "Press to write the above names to the security file."
- Const Getnames_hlp = "To retreive the user and company names from the security file."
- Const Register_hlp = "To write the registrtation code into the security file."
- Const Checkreg_hlp = "To find out whether the security file contains a registration code."
- Const CheckCode_hlp = "Check which feature the registration code in the security file enables."
- Const Start_hlp = "Start the usage timer and increment the 'Times used' counter."
- Const Stopnow_hlp = "To stop the usage timer and display usage statistics."
- Const Goodbye_hlp = "To quit this testprogram."
-
-
- Sub Cfgmake_Click ()
-
- file$ = Cfgname.Text
- a = cpCFGMake(file$, magicnumber, filevesion)
- fileisok = 1
- sernum$ = String$(15, 0)
- a = cpGetSernum(file$, sernum$)
- Snumber.Text = sernum$
- regcode.Text = ""
-
- Uname1.Text = ""
- Ucompany1.Text = ""
-
- Thour.Text = ""
- Tmin.Text = ""
- Tsec.Text = ""
- Chour.Text = ""
- CMin.Text = ""
- Csec.Text = ""
- Ttimes.Text = ""
-
- Checkmessage.Text = ""
- Codecheck.Text = ""
- End Sub
-
- Sub Regmake_Click ()
- fcode = Val(Feature.Text)
- rcode$ = String$(15, 0)
- ser$ = Snumber.Text
- a% = cpMakeRegCode(fcode, ser$, rcode$)
- regcode.Text = rcode$
- End Sub
-
- Sub Feature_Change ()
- regcode.Text = ""
- End Sub
-
- Sub Uname_Change ()
- Uname1.Text = ""
- End Sub
-
- Sub Ucompany_Change ()
- Ucompany1.Text = ""
- End Sub
-
- Sub Setnames_Click ()
- If fileisok Then
- Uname1.Text = ""
- Ucompany1.Text = ""
- u_name$ = uname.Text
- u_comp$ = Ucompany.Text
- cfg_name$ = Cfgname.Text
- a = cpSetRegisteredNames(cfg_name$, u_name$, u_comp$)
- End If
- End Sub
-
- Sub Getnames_Click ()
- If fileisok Then
- u_name$ = String$(28, 0)
- u_comp$ = String$(28, 0)
- cfg_name$ = Cfgname.Text
- a = cpGetRegisteredName(cfg_name$, u_name$)
- Uname1.Text = u_name$
- a = cpGetRegisteredCompany(cfg_name$, u_comp$)
- Ucompany1.Text = u_comp$
- End If
- End Sub
-
- Sub Checkreg_Click ()
- If fileisok Then
- a1$ = "Program is "
- a2$ = "registered"
- cfg_name$ = Cfgname.Text
- a = cpIsRegistered(cfg_name$)
- If a = 0 Then
- yes$ = ""
- Else
- yes$ = "not "
- End If
- Checkmessage.Text = a1$ + yes$ + a2$
- Else
- Checkmessage.Text = " No file! "
- End If
- End Sub
-
- Sub Register_Click ()
- If fileisok Then
- reg_code$ = regcode.Text
- cfg_name$ = Cfgname.Text
- If reg_code$ > "" Then
- a = cpRegisterProgram(cfg_name$, reg_code$)
- End If
- Checkmessage.Text = ""
- Codecheck.Text = ""
- End If
- End Sub
-
- Sub CheckCode_Click ()
- If fileisok Then
- code$ = String$(15, 0)
- cfg_name$ = Cfgname.Text
- a = cpCheckRegCode(cfg_name$, code$)
- If a = 0 Or a = WRONG_CODE Then
- t$ = "Regcode incorrect!"
- ElseIf a < 0 Then
- t$ = "Fileproblems!"
- Else
- t$ = "Feature " + Str$(a) + " registered"
- End If
- Else
- t$ = " No file! "
- End If
- Codecheck.Text = t$
-
- End Sub
-
- Sub Start_Click ()
- Thour.Text = ""
- Tmin.Text = ""
- Tsec.Text = ""
- Chour.Text = ""
- CMin.Text = ""
- Csec.Text = ""
- Ttimes.Text = ""
- If fileisok Then
- cfg_name$ = Cfgname.Text
- a = cpStartProgram(cfg_name$)
- End If
- End Sub
-
- Sub Stopnow_Click ()
- Dim times As Integer, t_hour As Integer, t_min As Integer, t_sec As Integer, c_hour As Integer, c_min As Integer, c_sec As Integer
- If Ttimes.Text = "" And fileisok Then
- cfg_name$ = Cfgname.Text
- a = cpEndProgram(cfg_name$)
- a = cpGetUStatistics(cfg_name$, times, t_hour, t_min, t_sec, c_hour, c_min, c_sec)
-
- Thour.Text = Str$(t_hour)
- Tmin.Text = Str$(t_min)
- Tsec.Text = Str$(t_sec)
- Chour.Text = Str$(c_hour)
- CMin.Text = Str$(c_min)
- Csec.Text = Str$(c_sec)
- Ttimes.Text = Str$(times)
- End If
- End Sub
-
- Sub Goodbye_Click ()
- Unload Form1
- End Sub
-
- Sub Cfgname_GotFocus ()
- Hlpbar.Text = Cfgname_hlp
- End Sub
-
- Sub Cfgmake_GotFocus ()
- Hlpbar.Text = Cfgmake_hlp
- End Sub
-
- Sub CheckCode_GotFocus ()
- Hlpbar.Text = CheckCode_hlp
- End Sub
-
- Sub Checkreg_GotFocus ()
- Hlpbar.Text = Checkreg_hlp
- End Sub
-
- Sub Feature_GotFocus ()
- Hlpbar.Text = Feature_hlp
- End Sub
-
- Sub Getnames_GotFocus ()
- Hlpbar.Text = Getnames_hlp
- End Sub
-
- Sub Goodbye_GotFocus ()
- Hlpbar.Text = Goodbye_hlp
- End Sub
-
- Sub Regmake_GotFocus ()
- Hlpbar.Text = Regmake_hlp
- End Sub
-
- Sub Setnames_GotFocus ()
- Hlpbar.Text = Setnames_hlp
- End Sub
-
- Sub Start_GotFocus ()
- Hlpbar.Text = Start_hlp
- End Sub
-
- Sub Stopnow_GotFocus ()
- Hlpbar.Text = Stopnow_hlp
- End Sub
-
- Sub Ucompany_GotFocus ()
- Hlpbar.Text = Ucompany_hlp
- End Sub
-
- Sub Uname_GotFocus ()
- Hlpbar.Text = Uname_hlp
- End Sub
-
- Sub Register_GotFocus ()
- Hlpbar.Text = Register_hlp
- End Sub
-
- Sub Cfgname_LostFocus ()
- fil$ = Cfgname.Text
- If magicnumber = cpGetFileinfo(fil$, vernum&) Then
- fileisok = 1
- sernum$ = String$(15, 0)
- a = cpGetSernum(fil$, sernum$)
- Snumber.Text = sernum$
- Else
- fileisok = 0
- Snumber.Text = ""
- End If
-
- regcode.Text = ""
-
- Uname1.Text = ""
- Ucompany1.Text = ""
-
- Thour.Text = ""
- Tmin.Text = ""
- Tsec.Text = ""
- Chour.Text = ""
- CMin.Text = ""
- Csec.Text = ""
- Ttimes.Text = ""
-
- Checkmessage.Text = ""
- Codecheck.Text = ""
- End Sub
-
-